import pandas as pd
import matplotlib.pyplot as plt


bwic_data = pd.read_excel(r"C:\Users\Administrator\PycharmProjects\PythonProject1\data\bwic.xlsx")
# bwic_data.reset_index(drop=True)

bwic_data = bwic_data[['cusip','market_price', 'created_time']]
bwic_data = bwic_data[bwic_data['cusip']=='37DS1526']

print(bwic_data)

bwic_data.reset_index(drop=True, inplace=True)
bwic_data.created_time = bwic_data.created_time.astype(str)

plt.figure(figsize=(16, 10), dpi=80)
plt.plot('created_time', 'market_price', data=bwic_data, color='tab:red')

xtick_location = bwic_data.index.tolist()[::50]
xtick_labels = [str(x)[-4:] for x in bwic_data.created_time.tolist()[::50]]
plt.xticks(ticks=xtick_location, labels=xtick_labels, rotation=0, fontsize=12, horizontalalignment='center', alpha=.7)

plt.yticks(fontsize=12, alpha=.7)
plt.title("Trade Price ", fontsize=22)
plt.grid(axis='both', alpha=.3)

# Remove borders
plt.gca().spines["top"].set_alpha(0.0)
plt.gca().spines["bottom"].set_alpha(0.3)
plt.gca().spines["right"].set_alpha(0.0)
plt.gca().spines["left"].set_alpha(0.3)
plt.show()